<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width , user_scalable=no,initial_scale=1.0" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"> </script>
<script type="text/javascript">
	function showPos() {
		if(navigator.geolocation == undefined) {
			alert("위치 정보를 이용할 수  없습니다.");
			return;
		}
		
		navigator.geolocation.getCurrentPosition( successCB , errorCB );
		
	}
	
	function successCB(position) {
		var lat = position.coords.latitude;
		var lon = position.coords.longitude;
		
		var map_div= document.getElementById("map_div");
		var latlng = new google.maps.LatLng(lat , lon);
		
		var gmap = new google.maps.Map(
			map_div , {
				zoom:16,
				center:latlng,
				mapTypeId: google.maps.MapTypeId.ROADMAP
			}		
		);
		
		var marker = new google.maps.Marker({
			position: latlng,
			map: gmap,
			title: "현재 위치"
		});
	}
	
	function errorCB(err) {
		alert("실패("+err.code+")" + err.message)
	}
</script>
</head>
<body>
<input type="button" value="위치정보 취득" onclick="showPos()"/>
<div id="map_div" style="width:320px; height:480px;"></div>
</body>
</html>